<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% content_for :page_title do %><%= join_title t(:page_title, "Collaboration"), @context.name %><% end %>

<% js_bundle :collaborations %>

<% content_for :right_side do %>
  <p><%= mt :description_rs, <<-HEREDOC, :google_url => "http://docs.google.com"
Free online web tools like [Google Docs](%{google_url}) are an excellent place for students to work on group projects or papers, take shared notes, etc.
Teacher *or* students can set up group collaborations.
HEREDOC
     %>
  </p>
<% end %>
<a href="#" class="external_link" target="_blank" style="display: none;">&nbsp;</a>

<header class="collaborations-header clearfix">
  <h1><%= t 'titles.current', "Current Collaborations" %></h1>

  <% if can_do(@context, @current_user, :create_collaborations) && !@hide_create_ui %>
    <a role="button" href="#" class="btn add_collaboration_link">
      <i class="icon-add" aria-hidden="true"></i>
      {{#t}}Start a new collaboration{{/t}}
    </a>
  <% end %>
</header>

<div id="no_collaborations_message" style="<%= hidden unless @collaborations.empty? %>">
  <% if can_do(@context, @current_user, :manage_content) %>
    <p><%= mt :description_teacher, <<-HEREDOC, :google_url => "http://docs.google.com"
**What do we mean by collaborations?**  We're talking about web-based tools that most
likely your students are already familiar with.  Students can use resources like
[Google Docs](%{google_url})
to work collaboratively on tasks like group papers or note-taking.  This page gives them
(and you) an easy place to keep track of those collaborations, and also to set them
up without having to swap emails.
HEREDOC
        %></p>
  <% else %>
    <p><%= mt :description_student, <<-HEREDOC, :google_url => "http://docs.google.com"
**What do we mean by collaborations?**  We're talking about web-based tools for
working together on a shared document.  You can use resources like
[Google Docs](%{google_url})
to work collaboratively on tasks like group papers or note-taking.  This page is
an easy place to keep track of those collaborations, and also to set them
up without having to swap emails.
HEREDOC
        %></p>
  <% end %>
  <% if can_do(@context, @current_user, :create_collaborations) && !@hide_create_ui %>
    <p>
      <%= t :how_to_start_a_new_collaboration, 'To find out more about a particular type of collaboration, click "Start a New Collaboration" and then choose that type in the dropdown list.' %>
    </p>
  <% end %>
</div>
<div id="collaborations">
  <%= @collaborations.map {|c| collaboration(c, @current_user, @user_has_google_drive)}.join.html_safe %>
</div>
<% if can_do(@context, @current_user, :create_collaborations) && !@hide_create_ui %>
  {{> views/collaborations/forms}}
<% end %>
